using System;
using dbvc.data;
using dbvc.Queries;

namespace dbvc.context.User
{
    public static partial class User
    {
        public static void save(this db_user self)
        {
            GenericQuery<db_user>.Create(self);
        }
    }

    public static class Activity
    {
        public static void save(this db_activity self)
        {
            GenericQuery<db_activity>.Create(self);
        }
    }

    public class CreateUser
    {
        private readonly db_activity activity;
        private readonly db_user user;
        private db_user principal;

        public CreateUser(db_user _principal, db_user _user)
        {
            principal = _principal;
            user = _user;

            activity = new db_activity {action = "add project", datestamp = DateTime.Now, userstamp = user.name};
        }

        public void Execute()
        {
            user.save();
            activity.save();
        }
    }
}